
#include <linux/module.h>
#include <linux/string.h>
#include <linux/fs.h>
#include <linux/slab.h>
#include <linux/vfs.h>

#include "lfs.h"

struct kmem_cache *lfs_inode_cache;
struct kmem_cache *lfs_inode_info_cache;
struct kmem_cache *lfs_dentry_cache;

static atomic_t lfs_sb_bdi_num = ATOMIC_INIT(0);

struct workqueue_struct *lfs_wq = NULL;



static int lfs_parse_options(struct lfs_sb *lsb, char *data)
{
	return 0;
}
static int lfs_sync_fs(struct super_block *sb, int wait);

static void lfs_put_super(struct super_block *sb)
{
}

static int lfs_remount_fs(struct super_block *sb, int *flags, char *data)
{

}
static const struct super_operations lfs_sops = {
	.alloc_inode = lfs_alloc_inode,
	.destroy_inode = lfs_destroy_inode,
	.drop_inode = lfs_drop_inode,
	.write_inode = lfs_write_inode,
	.put_super = lfs_put_sumper,
	.statfs = lfs_statfs,
	.remount_fs = lfs_remount_fs,
};

static int lfs_fill_super(struct super_block *sb, void *data, int silent)
{

	return 0;
}

static struct dentry *lfs_mount(struct file_system_type *fs_type, int flags, 
				const char *dev_name, void *data)
{
	return mount_nodev(fs_type, flags, data, lfs_fill_super);
}

static void lfs_kill_sb(struct super_block *sb)
{
	sync_inodes_sb(sb);
	kill_anon_super(sb);
}

static struct file_system_type lfs_type = {
	.owner = THIS_MODULE,
	.name = "lumperfs",
	.mount = lfs_mount,
	.kill_sb = lfs_kill_sb,
};

static void lfs_cleanup_cache(void)
{
	kmem_cache_destroy(lfs_inode_cache);
	
}
static int lfs_init_cache(void)
{
	
}


/* show the coding style */
static int __init lfs_init(void) 
{
	lfs_init_cache();
	
	register_filesystem(&lfs_type);

	return 0;
};

static void __exit lfs_exit(void) 
{
	unregister_filesystem(&lfs_type);
	lfs_cleanup_cache();
}

module_init(lfs_init)
module_exit(lfs_exit)

MODULE_AUTHOR("Haifeng Liu <bladehliu@gmail.com");
MODULE_DESCRIPTION("CHONG FILESYSTEM");
MODULE_LICENSE("GPL");
